package com.cgbl.cg.ui.mine

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.cgbl.cg.BR
import com.cgbl.cg.R
import com.cgbl.cg.adapter.CourseProfileDirectoryAdapter
import com.cgbl.cg.databinding.AppFragmentCourseDirectoryBinding
import com.cgbl.cg.databinding.AppFragmentCourseProfileBinding
import com.cgbl.cg.view.ExchangeCodePop
import com.cgbl.cg.view.PersonalSignPop
import com.cgbl.cg.vm.mine.CourseProfileViewModel
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.listener.OnItemClickListener
import com.lxj.xpopup.XPopup
import com.robot.base.base.activity.GLBaseFragment
import com.robot.base.model.CourseChaptarBean
import com.robot.base.model.CourseInfoBean

class CourseDirectoryFragment :
    GLBaseFragment<AppFragmentCourseDirectoryBinding, CourseProfileViewModel>() {

    private lateinit var courseProfileDirectoryAdapter: CourseProfileDirectoryAdapter

    override fun initContentView(
        inflater: LayoutInflater?,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): Int = R.layout.app_fragment_course_directory

    override fun initVariableId(): Int = BR.viewModel

    override fun initComponents() {
        courseProfileDirectoryAdapter = CourseProfileDirectoryAdapter()
        binding.recyclerView.apply {
            layoutManager = LinearLayoutManager(context)
            adapter = courseProfileDirectoryAdapter
        }

    }

    fun setCourseProfileData(data: CourseInfoBean) {
        courseProfileDirectoryAdapter.setNewInstance(data.infoChaptarVOS as MutableList<CourseChaptarBean>?)
    }
}